﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="CentersCost.aspx.cs" Inherits="Charts_CentersCost" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="FeaturedContent" runat="Server">
    <section class="featured">
        <div class="content-wrapper"  dir="rtl">
           هزینه پرداختی قبوض
        </div>
    </section>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="Server">
     <script lang="jv" type="text/javascript">
         function SelectItem(sender, e) {
             e.IsValid = (e.Value != '0');
         }
    </script>

    <div dir="rtl" style="width: 100%;">
        <asp:Label ID="TypeLabel" runat="server" Text="نوع انرژی:" SkinID="Caption" CssClass="lable"></asp:Label>
        <asp:DropDownList ID="TypeDropDownList" runat="server" SkinID="FormDropDownList" DataSourceID="ConstantEntityDataSource"
            DataTextField="ConstantName" DataValueField="ConstantValue">
        </asp:DropDownList>
        <asp:CustomValidator ID="TypeCustomValidator" runat="server" ClientValidationFunction="SelectItem"
            ControlToValidate="TypeDropDownList" Display="Dynamic" ErrorMessage="*" ValidateEmptyText="True"></asp:CustomValidator>
        <br />
        <asp:Label ID="StarLabel" runat="server" Text="از تاریخ:" SkinID="Caption" CssClass="lable"></asp:Label>
        <pdc:PersianDateTextBox ID="StartPersianDateTextBox" runat="server" PickerDirection="ToRight" ShowPickerOnTop="True"></pdc:PersianDateTextBox>
        <asp:RequiredFieldValidator ID="StartPersianDateRequiredFieldValidator" runat="server" ControlToValidate="StartPersianDateTextBox"
            Display="Dynamic" ErrorMessage="*"></asp:RequiredFieldValidator>
        <asp:Label ID="EndLabel" runat="server" Text="تا تاریخ:" SkinID="Caption" CssClass="lable"></asp:Label>
        <pdc:PersianDateTextBox ID="EndPersianDateTextBox" runat="server" PickerDirection="ToRight" ShowPickerOnTop="True"></pdc:PersianDateTextBox>
        <asp:RequiredFieldValidator ID="EndPersianDateRequiredFieldValidator" runat="server" ControlToValidate="EndPersianDateTextBox"
            Display="Dynamic" ErrorMessage="*"></asp:RequiredFieldValidator>
        <asp:CompareValidator ID="DateCompareValidator" runat="server" ControlToValidate="StartPersianDateTextBox" ControlToCompare="EndPersianDateTextBox" ErrorMessage="از تاریخ کوچکتر مساوی تا تاریخ است" Operator="LessThanEqual"></asp:CompareValidator>
        <br />
        <asp:LinkButton ID="ReportLinkButton" runat="server" OnClick="ReportLinkButton_Click" Text="گزارش" CssClass="button" />
        <br />
    </div>
    <br />
    <div style="float: right; width: 90%; vertical-align: top;" dir="rtl" class="gvclass">
        <asp:GridView ID="CentersCostGridView" runat="server" AllowPaging="True" AllowSorting="True"
            DataKeyNames="PkCenterID" DataSourceID="CentersCostSqlDataSource"
            Width="100%" AutoGenerateColumns="False">
            <Columns>
                <asp:BoundField DataField="PkCenterID" HeaderText="PkCenterID" ReadOnly="True" SortExpression="PkCenterID" Visible="False" />
                <asp:TemplateField HeaderText="منطقه">
                    <ItemTemplate>
                        <asp:DropDownList ID="LocationDropDownList" runat="server" Enabled="False" SkinID="GridDropDownList"
                            DataSourceID="LocationEntityDataSource" DataTextField="Name" DataValueField="ID"
                            SelectedValue='<%# Bind("FkLocationID") %>'>
                        </asp:DropDownList>
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="100px" />
                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="100px" />
                </asp:TemplateField>
                <asp:BoundField DataField="CenterName" HeaderText="نام مرکز" SortExpression="CenterName">
                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="100px" />
                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="100px" />
                </asp:BoundField>
                <asp:BoundField DataField="CenterPass" HeaderText="رمز شناسایی مرکز" SortExpression="CenterPass">
                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="200px" />
                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="200px" />
                </asp:BoundField>
                <asp:BoundField DataField="Price" HeaderText="هزینه" SortExpression="Price">
                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="100px" />
                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="100px" />
                </asp:BoundField>               
            </Columns>
        </asp:GridView>
    </div>

    <asp:EntityDataSource ID="LocationEntityDataSource" runat="server" ConnectionString="name=ICTBillingEntities" DefaultContainerName="ICTBillingEntities"
        EnableFlattening="False"
        CommandText="(SELECT  it.[PkLocationID] As ID, it.[LocationName] As Name FROM ICTBillingEntities.tbLocations AS it) UNION (SELECT x.[ConstantValue] as ID,x.[ConstantName] As Name from ICTBillingEntities.tbConstants as x where x.PkConstantID=2)">
    </asp:EntityDataSource>
    <asp:EntityDataSource ID="ConstantEntityDataSource" runat="server" ConnectionString="name=ICTBillingEntities" DefaultContainerName="ICTBillingEntities"
        EnableFlattening="False"
        CommandText="(SELECT x.[ConstantValue],x.[ConstantName]  from ICTBillingEntities.tbConstants as x where (x.[PkConstantID] = 2 || x.[FatherID] = 3))"
        EntityTypeFilter="" Select="">
    </asp:EntityDataSource>
    <asp:SqlDataSource ID="CentersCostSqlDataSource" runat="server" ConnectionString='<%$ ConnectionStrings:ICTBillingConnectionString %>' SelectCommand="spCentersCost" SelectCommandType="StoredProcedure">
        <SelectParameters>
            <asp:ControlParameter ControlID="StartPersianDateTextBox" PropertyName="DateValue" Name="StartDate" Type="DateTime"></asp:ControlParameter>
            <asp:ControlParameter ControlID="EndPersianDateTextBox" PropertyName="DateValue" Name="EndDate" Type="DateTime"></asp:ControlParameter>
            <asp:ControlParameter ControlID="TypeDropDownList" PropertyName="SelectedValue" Name="Type" Type="Byte"></asp:ControlParameter>
        </SelectParameters>
    </asp:SqlDataSource>
      <pdc:PersianDateScriptManager ID="PersianDateScriptManager" runat="server">
    </pdc:PersianDateScriptManager>
</asp:Content>


